<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <h1 id="title"></h1>

    <script>
        var colors=["red","blue","purper","green","black"];
        var i=0;

        setInterval(bian,100); //每隔0.1s 执行一次bian

        function bian(){
            document.getElementById("title").style.color=colors[i];
            i++;
            if(i==colors.length){
                i=0; //颜色重新开始
            }
        }



        setInterval(time,1000); //每隔1s 执行一次time
        function time(){
            var d=new Date();
            var str=d.getFullYear()+"年"+(d.getMonth()+1)+"月"+d.getDate()+"日"+d.getHours()+"时"+d.getMinutes()+"分"+d.getSeconds()+"秒"+d.getMilliseconds()+"毫秒";
            document.getElementById("title").innerHTML=str;
        }


    </script>
</body>
</html>